/**
 * author:Administrator
 * date:2016/1/4
 * desc:TODO
 */

'use strict';

var connedSeq = require('../conn/sequelize.js');
var Sequelize = require('sequelize');
var DataTypes = Sequelize;

var Ticket = connedSeq.define('ticket',
  {
    //
    id: {type: DataTypes.INTEGER(11), allowNull: false, primaryKey: true, autoIncrement: true},
    code: {type: DataTypes.STRING, allowNull: false, unique: true},
    orderId: {type: DataTypes.INTEGER(11), allowNull: false},

    customerId: {type: DataTypes.INTEGER(11), allowNull: false},
    vendorId: {type: DataTypes.INTEGER(11), allowNull: false},
    snapshotId: {type: DataTypes.INTEGER(11), allowNull: false},
    //
    shopId: {type: DataTypes.INTEGER(11), allowNull: true},
    keeperId: {type: DataTypes.INTEGER(11), allowNull: true},
    consumedAt: {type: DataTypes.INTEGER(11), allowNull: true},
    createdAt: {type: DataTypes.INTEGER(11), allowNull: false},
    refundMoney: {type: DataTypes.FLOAT, allowNull: false},
    status: {type: DataTypes.STRING, allowNull: false},
  },

  {
    tableName: 'ticket',
    freezeTableName: true,
    createdAt: false,
    updatedAt: false
  });


module.exports = Ticket;
